package demo.fristserice.service.impl;/**
 * @author wqf
 * @date 2019/11/13 13:47
 */


import com.alibaba.fastjson.JSON;
import demo.fristserice.common.Demo;
import demo.fristserice.dao.DemoRepositoryDao;
import demo.fristserice.service.DemoService;
import demo.fristserice.service.feign.FeignClientDemo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version : 1.0
 * @ClassName: DemoServiceImpl
 * @Auther: wqf
 * @Date: 2019/11/13 13:47
 */
@Service
public class DemoServiceImpl implements DemoService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    FeignClientDemo feignClientDemo;
    @Autowired
    DemoRepositoryDao demoRepositorydao;
    @Override
    public List<Demo> getTest() {
        List<Demo> demoRepositorydaoTest = demoRepositorydao.getTest();
        System.out.println("逗你玩");
        logger.info("瞅啥瞅");
        return demoRepositorydaoTest;
    }

    @Override
    public List<Demo> getTestlist(Demo demo) {

        logger.info("=================调用demoServer");
        List getlist = feignClientDemo.getlist(demo);

        logger.info("调用demoServer  : "+ JSON.toJSONString(getlist));
        return demoRepositorydao.getTestlist(demo);
    }
}
